feat: eliminate Editor.xib with programmatic NSWindow + SwiftUI root#238
Merged
feat: eliminate Editor.xib with programmatic NSWindow + SwiftUI root#238
Conversation
…237) Replace the 515-line Editor.xib and ~28 legacy ObjC files (~2800 LOC) with a programmatic NSWindow containing a single SwiftUI EditorView root. This is the final step (PR 3 of 3) in the editor modernization series, following the sidebar (#234) and content area (#236) SwiftUI migrations. New SwiftUI components: - EditorView: root view with NavigationSplitView, owns @StateObject HostsDataStore - EditorToolbar: 4 toolbar items using SF Symbols (plus, minus, square.and.arrow.down, power) - StatusBarView: files count label, read-only lock icon, busy spinner - EditorWindowPresenter: @objc bridge creating NSWindow programmatically Key changes: - HostsDataStore converted from singleton to @StateObject-owned instance - Busy indicator moved from ApplicationController to HostsDataStore with thread-safe notification observers (queue: .main) - Toolbar Remove now uses moveToTrash:true (reversible) matching sidebar - Window lifecycle (open/close/reopen, dock show/hide) preserved
The self.hostsGroups = self.hostsGroups line looks like a no-op but is needed to trigger @published willSet since HostsGroup objects are reference types whose property mutations don't change the array identity.
Resolve pbxproj conflicts from About box SwiftUI PR (#237): - Remove files deleted by both branches (ExtendedNSTextView, NSToolbarPoofAnimator, HostsListView, ExtendedNSSplitView, AboutBoxController, ExtendedNSApplication) - Keep new About box Swift files (AboutBoxView, AboutBoxPresenter) - Fix UUID collision: About box files EE→FF prefix to avoid conflict with editor test file IDs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Editor.xiband ~28 legacy ObjC files (~2800 LOC) with a programmaticNSWindow+ SwiftUIEditorViewrootplus,minus,square.and.arrow.down,power,lock.fill)New SwiftUI components
EditorViewNavigationSplitView, owns@StateObject HostsDataStoreEditorToolbarStatusBarViewEditorWindowPresenter@objcbridge creatingNSWindowprogrammaticallyKey changes
HostsDataStoreconverted from singleton to@StateObject-owned instance withdeinitcleanupApplicationControllertoHostsDataStorewith thread-safe notification observers (queue: .main)moveToTrash:true(reversible, matches sidebar context menu)Test changes
ApplicationControllerTestsupdated: NIB loading →EditorWindowPresenter.createEditorWindow()HostsDataStoreTestsupdated:.sharedsingleton →HostsDataStore()instances, added busy state testsEditorWindowPresenterTests: window config, delegate, style mask (7 test cases)Test plan